package com.hzit.controller;

import com.hzit.client.ClassesClient;
import com.hzit.entity.Student;
import com.hzit.service.StudentService;
import com.hzit.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wf
 * @since 2023-07-14
 */
@RestController
@RequestMapping("/student")
public class StudentController {
	@Autowired
	private StudentService studentService;
	@Autowired
	private ClassesClient classesClient;

	@GetMapping("/list")
	public R findAll(){
		List<Student> list = studentService.list();
		return R.ok().put("list",list);
	}

	//查询所有班级
	@GetMapping("/classes/list")
	public R classesList(){
		return classesClient.list();
	}
}
